{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(3,)\n",
      "(3, 3)\n",
      "0: [[0.8275  0.13375 0.03875]\n",
      " [0.2675  0.66375 0.06875]\n",
      " [0.3875  0.34375 0.26875]]\n",
      "1: [[0.7745  0.17875 0.04675]\n",
      " [0.3575  0.56825 0.07425]\n",
      " [0.4675  0.37125 0.16125]]\n",
      "2: [[0.73555  0.212775 0.051675]\n",
      " [0.42555  0.499975 0.074475]\n",
      " [0.51675  0.372375 0.110875]]\n",
      "3: [[0.70683  0.238305 0.054865]\n",
      " [0.47661  0.450515 0.072875]\n",
      " [0.54865  0.364375 0.086975]]\n",
      "4: [[0.685609  0.2573725 0.0570185]\n",
      " [0.514745  0.4143765 0.0708785]\n",
      " [0.570185  0.3543925 0.0754225]]\n",
      "5: [[0.6699086 0.2715733 0.0585181]\n",
      " [0.5431466 0.3878267 0.0690267]\n",
      " [0.585181  0.3451335 0.0696855]]\n",
      "6: [[0.65828326 0.28213131 0.05958543]\n",
      " [0.56426262 0.36825403 0.06748335]\n",
      " [0.5958543  0.33741675 0.06672895]]\n",
      "7: [[0.64967099 0.28997265 0.06035636]\n",
      " [0.5799453  0.35379376 0.06626094]\n",
      " [0.60356362 0.33130471 0.06513167]]\n",
      "8: [[0.64328888 0.29579253 0.06091859]\n",
      " [0.59158507 0.34309614 0.06531879]\n",
      " [0.60918588 0.32659396 0.06422016]]\n",
      "9: [[0.63855852 0.30011034 0.06133114]\n",
      " [0.60022068 0.33517549 0.06460383]\n",
      " [0.61331143 0.32301915 0.06366943]]\n",
      "10: [[0.635052   0.30331295 0.06163505]\n",
      " [0.60662589 0.3293079  0.06406621]\n",
      " [0.61635051 0.32033103 0.06331846]]\n",
      "11: [[0.63245251 0.30568802 0.06185947]\n",
      " [0.61137604 0.32495981 0.06366415]\n",
      " [0.61859473 0.31832073 0.06308454]]\n",
      "12: [[0.63052533 0.30744922 0.06202545]\n",
      " [0.61489845 0.32173709 0.06336446]\n",
      " [0.6202545  0.31682232 0.06292318]]\n",
      "13: [[0.62909654 0.30875514 0.06214832]\n",
      " [0.61751028 0.31934817 0.06314155]\n",
      " [0.62148319 0.31570774 0.06280907]]\n",
      "14: [[0.62803724 0.30972343 0.06223933]\n",
      " [0.61944687 0.3175772  0.06297594]\n",
      " [0.6223933  0.3148797  0.062727  ]]\n",
      "15: [[0.62725186 0.31044137 0.06230677]\n",
      " [0.62088274 0.31626426 0.062853  ]\n",
      " [0.62306768 0.31426501 0.06266732]]\n",
      "16: [[0.62666957 0.31097368 0.06235675]\n",
      " [0.62194736 0.31529086 0.06276178]\n",
      " [0.62356749 0.31380891 0.0626236 ]]\n",
      "17: [[0.62623785 0.31136835 0.0623938 ]\n",
      " [0.6227367  0.31456919 0.06269412]\n",
      " [0.62393798 0.31347059 0.06259143]]\n",
      "18: [[0.62591777 0.31166097 0.06242126]\n",
      " [0.62332193 0.31403413 0.06264394]\n",
      " [0.62421263 0.31321968 0.0625677 ]]\n",
      "19: [[0.62568045 0.31187792 0.06244162]\n",
      " [0.62375584 0.31363743 0.06260672]\n",
      " [0.62441624 0.31303361 0.06255015]]\n",
      "20: [[0.6255045  0.31203878 0.06245672]\n",
      " [0.62407756 0.31334332 0.06257913]\n",
      " [0.62456719 0.31289565 0.06253716]]\n",
      "21: [[0.62537405 0.31215804 0.06246791]\n",
      " [0.62431608 0.31312525 0.06255867]\n",
      " [0.62467911 0.31279335 0.06252754]]\n",
      "22: [[0.62527733 0.31224646 0.06247621]\n",
      " [0.62449293 0.31296357 0.0625435 ]\n",
      " [0.62476209 0.3127175  0.06252042]]\n",
      "23: [[0.62520562 0.31231202 0.06248236]\n",
      " [0.62462404 0.3128437  0.06253225]\n",
      " [0.62482361 0.31266126 0.06251514]]\n",
      "24: [[0.62515245 0.31236063 0.06248692]\n",
      " [0.62472126 0.31275483 0.06252391]\n",
      " [0.62486922 0.31261956 0.06251122]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "t0=np.array([0.1, 0.2, 0.7])\n",
    "\n",
    "print(t0.shape)\n",
    "\n",
    "p=np.array([\n",
    "    [0.9, 0.075, 0.025],\n",
    "    [0.15,0.8,0.05],\n",
    "    [0.25,0.25,0.5]\n",
    "])\n",
    "\n",
    "print(p.shape)\n",
    "# t1=t0\n",
    "t1=p\n",
    "for i in range(25):\n",
    "    t1=np.dot(t1,p)\n",
    "    print(\"{}: {}\".format(i, t1))\n",
    "\n",
    "# print(t0)\n",
    "# print(sum(t1))\n",
    "\n",
    "# print(0.1*0.9+0.2*0.15+0.25*0.7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0.1 0.2 0.7]\n",
      "[[0.9   0.075 0.025]\n",
      " [0.15  0.8   0.05 ]\n",
      " [0.25  0.25  0.5  ]]\n",
      "[0.295  0.3425 0.3625]\n",
      "[[0.9   0.15  0.25 ]\n",
      " [0.075 0.8   0.25 ]\n",
      " [0.025 0.05  0.5  ]]\n",
      "[0.30025  0.336375 0.340625]\n",
      "0.046875\n",
      "0.04695\n"
     ]
    }
   ],
   "source": [
    "print(t0)\n",
    "print(p)\n",
    "t1= np.dot(t0,p)\n",
    "print(t1)\n",
    "print(p.T)\n",
    "\n",
    "t2 = np.dot(t1,p.T)\n",
    "print(t2)\n",
    "print(0.625*0.075)\n",
    "print(0.313*0.15)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
